package sedh.project

import grails.test.*

class ProgramaIntTests extends GroovyTestCase {
	
	def prog1, prog2
	
    protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }

    void testSalvaPrograma() {
		prog1 = new Programa(nome: "Programa1", descricao: "Descricao1").save()
		prog2 = new Programa(nome: "Programa2", descricao: "Descricao2").save()
		
		assertNotNull(prog1)
		assertNotNull(prog2)
		
		assertEquals 2, Programa.count()

    }
	
	void testDeletaProgramas() {
		def prog = Programa.getAll()
		
		for (Programa p : prog) {
			prog.delete(flush:true)
		}
		
		assertEquals 0, Programa.count()
	}
}
